<html lang="en">
<%-include ../public/header.ejs%>


<script src="<%=host%>/public/javascripts/jqPaginator.js" type="text/javascript"></script>

<!--[if lt IE 7 ]> <body class="ie ie6"> <![endif]-->
<!--[if IE 7 ]> <body class="ie ie7 "> <![endif]-->
<!--[if IE 8 ]> <body class="ie ie8 "> <![endif]-->
<!--[if IE 9 ]> <body class="ie ie9 "> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!-->
<body class="">
<!--<![endif]-->






<!--左侧菜单-->

<%-include ../public/navbar.ejs%>

<%-include ../public/aside.ejs%>
<style>


    tr{
        width:100%;

    }
    .table td{

        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }
    .table {
        table-layout: fixed;
    }

</style>


<div class="content">

    <div class="header">

        <h1 class="page-title">文章列表</h1>
    </div>

    <ul class="breadcrumb">
        <li><a href="index.html">文章首页</a> <span class="divider">/</span></li>
        <li class="active">文章列表</li>
    </ul>

    <div class="container-fluid">
        <div class="row-fluid">

            <div class="btn-toolbar">
                <a href="<%=host%>/admin/article/add" class="btn btn-primary"><i class="icon-plus"></i> 增加新闻</a>
                <div class="btn-group">
                </div>
            </div>
            <div class="well">
                <table class="table">
                    <thead>
                    <tr>
                        <th>标题</th>
                        <th>图片</th>
                        <th>作者</th>
                        <th>描述</th>

                        <th>发布日期</th>
                        <th style="width: 26px;"></th>
                    </tr>
                    </thead>
                    <tbody>


                    <%for(var i=0;i<list.length;i++) {%>

                    <tr>

                        <td><%=list[i].title%></td>
                        <td><img  style="width: 60px;height: 60px" src="<%=host%>/<%=list[i].img%>" > </td>
                        <td><%=list[i].author%></td>
                        <td><%=list[i].description%></td>

                        <td><%=list[i].add_time%></td>
                        <td>
                            <a href="<%=host%>/admin/article/edit?id=<%=list[i]._id%>"><i class="icon-pencil"></i></a>
                            <a href="<%=host%>/admin/article/delete?id=<%=list[i]._id%>"><i class="icon-remove"></i></a>

                        </td>
                    </tr>

                    <%}%>

                    </tbody>
                </table>
            </div>

            <ul class="pagination" id="pagination1"></ul>

            <div class="modal small hide fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                    <h3 id="myModalLabel">Delete Confirmation</h3>
                </div>
                <div class="modal-body">
                    <p class="error-text"><i class="icon-warning-sign modal-icon"></i>Are you sure you want to delete the user?</p>
                </div>
                <div class="modal-footer">
                    <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
                    <button class="btn btn-danger" data-dismiss="modal">Delete</button>
                </div>
            </div>



            <footer>
                <hr>

                <!-- Purchase a site license to remove this link from the footer: http://www.portnine.com/bootstrap-themes -->
                <p class="pull-right">A <a href="http://www.portnine.com/bootstrap-themes" target="_blank">Free Bootstrap Theme</a> by <a href="http://www.portnine.com" target="_blank">Portnine</a></p>

                <p>&copy; 2012 <a href="http://www.portnine.com" target="_blank">Portnine</a></p>
            </footer>

        </div>
    </div>
</div>

<style>
    .table th,.table td {
        padding: 8px;
        line-height: 60px;
        text-align: center;
        vertical-align: top;
        border-top: 1px solid #dddddd;
    }
</style>

<script src="<%=host%>/lib/bootstrap/js/bootstrap.js"></script>
<script type="text/javascript">
    $("[rel=tooltip]").tooltip();
    $(function() {
        $('.demo-cancel-click').click(function(){return false;});
    });

    $('#pagination1').jqPaginator({
        totalPages: <%= totalPage%>,
        visiblePages: 5,
        currentPage:<%= page%>,
        first: '<li class="first"><a href="javascript:;">第一页</a></li>',
        prev: '<li class="prev"><a href="javascript:;">上一页</a></li>',
        next: '<li class="next"><a href="javascript:;">下一页</a></li>',
        last: '<li class="last"><a href="javascript:;">最后一页</a></li>',
        page: '<li class="page"><a href="javascript:;">{{page}}</a></li>',
        onPageChange: function (num, type) {
            console.log(num);
            /*$('#text').html('当前第' + num + '页');*/
            if(type == 'change'){
                location.href='<%= host%>/admin/article?page='+num;
            }

        }
    });
</script>

</body>
</html>


